﻿using car.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace car.Controllers
{
    public class HomeController : Controller
    {
        public static string UserUid = null;
        private readonly ILogger<HomeController> _logger;

        public HomeController(ILogger<HomeController> logger)
        {
            _logger = logger;
        }
        public IActionResult AdminIndex()
        {
            return View();
        }
        public IActionResult UserIndex()
        {
            
            //if(id == null)
            //{
            //    ViewData["Message"] = false;
            //}
            //else
            //{
            //    ViewData["Message"] = true;
            //}
            //HomeController.UserUid = id;
            //ViewData["uid"]=HomeController.UserUid;
            return View();
        }
        public IActionResult Index()
        {
            using (var db = new carContext())
            {
                var user=db.User.ToList();
                return View(user);
            }
        }
        public IActionResult Exit()
        {
            return View();
        }

 

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
